package com.runfast.waimai.service.impl;

import com.runfast.common.service.BaseService;
import com.runfast.waimai.dao.mapper.RunfastGoodsSellChildrenMapper;
import com.runfast.waimai.dao.model.RunfastGoodsSellChildren;
import com.runfast.waimai.dao.model.RunfastGoodsSellChildrenExample;
import com.runfast.waimai.service.RunfastGoodsSellChildrenService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class RunfastGoodsSellChildrenServiceImpl extends BaseService<RunfastGoodsSellChildren, Integer, RunfastGoodsSellChildrenExample> implements RunfastGoodsSellChildrenService {
   @Resource
    RunfastGoodsSellChildrenMapper dao;
    @Override
    public List<RunfastGoodsSellChildren> findByOrderCode(String orderCode) {
        return dao.findByOrderCode(orderCode);
    }

    @Override
    public RunfastGoodsSellChildren findById(Integer id) {
        return dao.findById(id);
    }

    @Override
    public List<RunfastGoodsSellChildren> findbyorderid(Integer id) {
        return dao.findbyorderid(id);
    }

    @Override
    public int updateFindByPid(Integer pid , Integer status) {

        List<RunfastGoodsSellChildren> list = dao.findbyorderid(pid);
        int size=0;
        if(list!=null){
            for(RunfastGoodsSellChildren g :list){
                g.setStatus(status);
               dao.updateByPrimaryKey(g);
            }
            size=list.size();
        }
        return size;
    }
}